package com.xyy.ebattery.tcp.start.runner;

import com.alibaba.cloud.nacos.registry.NacosAutoServiceRegistration;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
/**
 * @Description TODO
 * @Author JIA BOYAN
 * Date 2025/6/16 12:58
 */
@Slf4j
@Component
public class NacosRegistrationRunner implements ApplicationRunner {

    @Autowired
    private NacosAutoServiceRegistration registration;

    @Value("${server.port:8080}")
    private Integer port;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        registration.setPort(port);
        registration.start();
        log.info("nacos registry done");
    }
}
